/**
 * Template.java
 *
 * Copyright (c) 2010 Prj.Manager All Rights Reserved.
 *
 * This source file may not be copied, modified or redistributed,
 * in whole or in part, in any form or for any reason, without the express
 * written consent of Prj.Manager .
 **/

package ro.prjmanager.model;


import javax.persistence.*;

/**
 * This class from the domain model is mapping the table template
 * @author Viorel Tacliciu
 * @version 1
 */

@Table(name="template")
@Entity
public class  Template{

    //define attributes that maps all columns of the coresponding table
    //this attribute maps the primary key column ID
    private java.lang.Integer id;
    //this attribute maps an bidirectional association
    //it means that FK_TEMPLATE from table generic_components is a foreign key to ID
    private java.util.List<GenericComponents> fkTemplateGenericComponents;
    //this attribute maps the column NAME
    private  java.lang.String  name;
    //this attribute maps the column VM_FILE
    private  byte[]  vmFile;
    //this attribute maps the column NEED_UPDATE
    private boolean needUpdate;
    //this attribute maps the column REPLACER
    private  java.lang.String  replacer;
    //this attribute maps the column FILE_GEN_EXT
    private  java.lang.String  fileGenExt;
    //this attribute maps the column FILE_GEN_NAME
    private  java.lang.String  fileGenName;
    //this attribute maps the foreign key column FK_PROJECT_DB
    private ProjectDb fkProjectDb;
    //end mapping columns

    //define getters and setters with coresponding ejb3 annotation, depending of the type
    //of the relation for the column

    /**
     * Mapping the primary key
     * @return - java.lang.Integer the primary key for this entity
     **/
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "ID")
    public  java.lang.Integer  getId(){
        return this.id;
    }

    /**
     * The setter for ID column
     * @param id -  an  java.lang.Integer  object
     **/
    public void setId( java.lang.Integer  id){
        this.id=id;
    }
    /**
     * This method maps an OneToMany relation between this table and
     * GenericComponents table
     * @return - an list of GenericComponents objects
     **/
    @OneToMany(cascade=CascadeType.REFRESH)
    @JoinColumn(name = "FK_TEMPLATE",referencedColumnName = "ID") 
    public java.util.List<GenericComponents> getFkTemplateGenericComponents(){
        return this.fkTemplateGenericComponents;
    }
    
    /**
     * This method sets the field fkTemplateGenericComponents of this entity
     * @param fkTemplateGenericComponents - an list of GenericComponents objects
     **/
    public void setFkTemplateGenericComponents(java.util.List<GenericComponents> fkTemplateGenericComponents){
        this.fkTemplateGenericComponents=fkTemplateGenericComponents;
    }
    /**
     * This method gets the name attribute
     * @return - an  java.lang.String  object
     **/
    @Column(name = "NAME")
    public  java.lang.String  getName(){
        return this.name;
    }

    /**
     * The setter for NAME column
     * @param name -  an  java.lang.String  object
     **/
    public void setName( java.lang.String  name){
        this.name=name;
    }
    /**
     * This method gets the vmFile attribute
     * @return - an  byte[]  object
     **/
    @Column(name = "VM_FILE")
    @Lob
    public  byte[]  getVmFile(){
        return this.vmFile;
    }

    /**
     * The setter for VM_FILE column
     * @param vmFile -  an  byte[]  object
     **/
    public void setVmFile( byte[]  vmFile){
        this.vmFile=vmFile;
    }
    /**
     * This method gets the needUpdate attribute
     * @return - an  java.lang.Integer  object
     **/
     @Column(name = "NEED_UPDATE")
    public boolean isNeedUpdate() {
        return needUpdate;
    }

    /**
     * The setter for NEED_UPDATE column
     * @param needUpdate -  an  java.lang.Integer  object
     **/
    public void setNeedUpdate(boolean needUpdate) {
        this.needUpdate = needUpdate;
    }
    /**
     * This method gets the replacer attribute
     * @return - an  java.lang.String  object
     **/
    @Column(name = "REPLACER")
    public  java.lang.String  getReplacer(){
        return this.replacer;
    }

    /**
     * The setter for REPLACER column
     * @param replacer -  an  java.lang.String  object
     **/
    public void setReplacer( java.lang.String  replacer){
        this.replacer=replacer;
    }
    /**
     * This method gets the fileGenExt attribute
     * @return - an  java.lang.String  object
     **/
    @Column(name = "FILE_GEN_EXT")
    public  java.lang.String  getFileGenExt(){
        return this.fileGenExt;
    }

    /**
     * The setter for FILE_GEN_EXT column
     * @param fileGenExt -  an  java.lang.String  object
     **/
    public void setFileGenExt( java.lang.String  fileGenExt){
        this.fileGenExt=fileGenExt;
    }
    /**
     * This method gets the fileGenName attribute
     * @return - an  java.lang.String  object
     **/
    @Column(name = "FILE_GEN_NAME")
    public  java.lang.String  getFileGenName(){
        return this.fileGenName;
    }

    /**
     * The setter for FILE_GEN_NAME column
     * @param fileGenName -  an  java.lang.String  object
     **/
    public void setFileGenName( java.lang.String  fileGenName){
        this.fileGenName=fileGenName;
    }
    /**
     * This method maps an ManyToOne relation between this entity and
     * project_db entity
     * @return - an ProjectDb object
     **/
    @ManyToOne(cascade=CascadeType.REFRESH)
    @JoinColumn(name = "FK_PROJECT_DB",referencedColumnName = "ID")
    public ProjectDb getFkProjectDb(){
        return this.fkProjectDb;
    }

    /**
     * This method sets the field fkProjectDb of this entity
     * @param fkProjectDb - an ProjectDb object
     **/
    public void setFkProjectDb(ProjectDb fkProjectDb){
        this.fkProjectDb=fkProjectDb;
    }
}



